package com.zhao.simpleFactory.factory;

import com.zhao.simpleFactory.pojo.Animal;
import com.zhao.simpleFactory.pojo.impl.Cat;
import com.zhao.simpleFactory.pojo.impl.Dog;
import lombok.extern.slf4j.Slf4j;

//动物创造工厂
@Slf4j
public class AnimalFactory {

    public static Animal createAnimal(String name) {
        if (name.equalsIgnoreCase("cat")) {
            log.info("动物工厂创建猫。");
            return new Cat();
        } else if (name.equalsIgnoreCase("dog")) {
            log.info("动物工厂创建狗。");
            return new Dog();
        }
        return null;
    }
}
